/**
 * 
 */
package com.googlecode.iant.internal.project;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.springframework.core.io.Resource;

import com.googlecode.iant.AntFacade;
import com.googlecode.iant.project.IDependency;
import com.googlecode.iant.project.IProject;
import com.googlecode.iant.project.IProjectStructure;

/**
 * @author ccpascu
 *
 */
public class IAntProject implements IProject {

	private List<IDependency> dependencies = new ArrayList<IDependency>();
	private IProjectStructure structure;
	private Resource resource;
	private Project project;

	public IAntProject(Resource source) {
		this.resource = source;
		project = AntFacade.createAntProject(source);
	}

	@Override
	public Project getAntProject() {
		return project;
	}
	
	public final void addDependency(IDependency dependency) {
		dependencies.add(dependency);
	}

	@Override
	public final List<IDependency> getDependencies() {
		return Collections.unmodifiableList(dependencies);
	}

	@Override
	public final IProjectStructure getStructure() {
		return structure;
	}
	
	public final void setStructure(IProjectStructure structure) {
		this.structure = structure;
	}

}
